import requests
import json

# 调用千问7b
def qwen_7b_model_reply(info, prompt):
    url = "http://127.0.0.1:8001/task/chat_qwen_7b"
    payload = {
        "info": info,
        "prompt": prompt
    }
    # 发送POST请求
    response = requests.post(url, json=payload)
    return response.json()

# 调用千问14b
def qwen_14b_model_reply(info, prompt):
    url = "http://127.0.0.1:8002/task/chat_qwen_14b"
    messages = [
        {"role": "system", "content": prompt},
        {"role": "user", "content": info}
    ]
    payload = {
        "messages": messages
    }
    # 发送POST请求
    response = requests.post(url, json=payload)
    return response.json()

# 调用qwen14b进行裁决
def qwen_14b_model_judge(user_prompt, agent_prompt):
    url = "http://127.0.0.1:8002/task/qwen_14b_judge"
    messages = [
        {"role": "system", "content": agent_prompt},
        {"role": "user", "content": user_prompt}
    ]

    payload = {
        "messages": messages
    }

    # 发送POST请求
    response = requests.post(url, json=payload)
    return response.json()
